let SYSTEM_INFO = uni.getSystemInfoSync()

// 状态栏高度
export const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight || 15

//胶囊按钮与状态栏之间的间隔
export const getInstance = () => {
	if(uni.getMenuButtonBoundingClientRect) { 
		// 胶囊按钮信息
		let { top } = uni.getMenuButtonBoundingClientRect()
		return top - getStatusBarHeight()
	}
		
	return 0
}

// 标题栏高度
export const getTitleBarHeight = () => {
	if(uni.getMenuButtonBoundingClientRect) {
		// 胶囊按钮信息
		let { top, height } = uni.getMenuButtonBoundingClientRect()
		// 标题栏高度  胶囊按钮高度 + 胶囊按钮的上下两边距
		let titleBarHeight = (top - getStatusBarHeight()) * 2 + height
		return titleBarHeight
	}
		
	return 40;
}

// 导航栏整体高度
export const getNavBarHeight = () => {
	let navBarHeight = getStatusBarHeight() + getTitleBarHeight()
	return navBarHeight
}

// 抖音小程序 左侧图标位置兼容
export const getLeftIconLeft = ()=> {
	// #ifdef MP-TOUTIAO
		let {leftIcon:{left,width}}  = tt.getCustomButtonBoundingClientRect();
		return left+ parseInt(width);
	// #endif
	
	// #ifndef MP-TOUTIAO
		return 0
	// #endif	
}